<section>
    <div class="container">
        <div class="row">
            <div class="span12">	            	
                <ul class="breadcrumb">
                    <li class="previous"><a href="<?php echo SITE_URL; ?>">Home /</a></li>                
                    <li class="disable"><a href="javascript:void(0);">Manage My Classes</a></li>
                </ul> 
                <div class="common">
                    <div class="whiteBg greenBor padding20px">
                        <h5 class="fnt-size20 txtgreen">Purchased Classes</h5>
                    </div>
                </div>
                <?php
                $this->widget('zii.widgets.CListView', array(
                    'dataProvider' => $purchaseClassCourse,
                    'summaryText' => '',
                    'itemView' => '_purachseClassCourse',
                ));
                ?>
              
                <div class="padding20px"></div>
                <div class="common">
                    <div class="whiteBg greenBor padding20px">
                        <h5 class="fnt-size20 txtgreen">Query Classes/Course</h5>
                    </div>
                </div>


                <?php
                $this->widget('zii.widgets.CListView', array(
                    'dataProvider' => $dataProvider,
                    'summaryText' => '',
                    'itemView' => '_learnClassesCourses',
                ));
                ?>




            </div>
        </div>
    </div>
</section>
<?php
$allClassCourseInfo = array();
$classDetails = literalEndingTommorow('', '', '');
$courseDetails = runningCurrentCoursesByUser('', '', ''); //Null parameter means these value $profiles, $userType, $getValue)
$allClassCourseInfo = array_merge($classDetails, $courseDetails);
usort($allClassCourseInfo, 'date_compare');
$validatedata = literalendingtommorowValiadte($allClassCourseInfo);
if (!empty($validatedata)) {
    $this->renderPartial('/classes/literallyEndingtomorrow', array('allClassCourseInfo' => $allClassCourseInfo));
}
?>
<script type="text/javascript" src="<?php echo ThemePath(); ?>/js/jquery.nicescroll.js"></script>
<script>
    jQuery(document).ready(function() {
        $('select').fancyfields();
        $(".flatui").fancyfields();
        $(".customSBDemo").fancyfields({customScrollBar: false});

        $("#demoReset").click(function() {
            $(".flatui").fancyfields("reset");
            $(".customSBDemo").fancyfields("reset");
        });
    });
    jQuery(document).ready(function() {
        jQuery('#reviewCarousel').carousel({
            interval: 4000
        })

    });

    jQuery(document).ready(function($) {
        $('.crsl-items1').respCaro({overflow: false, visible: 3, itemMinWidth: 300, itemMargin: 20, autoRotate: 5000});

    });

    function reviewCourseClasses(id, classCourseId) {
        if ($("#get_click_value_review_class_" + id).val() == '') {
            $("#get_click_value_review_class_" + id).val('1');
            $(".reviewclassfromUser").hide();
            $(".errorMessage").text('');
            $('.showClassuserBtn').show();
            $('#review_cancel_btn_' + id).show();
            $("#rate_class_btn_" + id).hide();
            $("#review_trainer_btn_" + id).hide();
            $("#rate_trainer_btn_" + id).hide();
            $("#review_class_box_" + id).show("slow", function() {
                // Animation complete.
            });
        }
        else {
            var reviewText = $("#reviews_text_classe_" + id).val();
            var classCourseval = $("#review_class_course_id_" + id).val();

            if (reviewText == '') {
                $("#errorMessage_msg_class_review_" + id).text('Message  can not blank.')
                return false;
            }

            jQuery.ajax({
                'type': 'POST',
                'url': "<?php echo Yii::app()->createAbsoluteUrl("Reviews/create"); ?>",
                'data': "text=" + reviewText + "&" + classCourseval + "=" + classCourseId,
                'beforeSend': function(jqXHR, settings) {
                    $("#AjaxLoader_" + id).show();
                },
                'success': function(data) {
                    $("#AjaxLoader_" + id).hide();
                    if (data != "redirect") {
                        $("#get_click_value_review_class_" + id).val('');
                        $('.showClassuserBtn').show();
                        $('#review_cancel_btn_' + id).hide();
                        $("#reviews_text_classe_" + id).val('');
                        $('#review_class_box_' + id).hide();
                        $("#formResult_" + id).html(data);
                    }
                },
                'cache': false
            });
        }



    }


    function trainerReviews(id, userId, userType) {
        if ($("#get_click_value_review_trainer_" + id).val() == '') {
            $("#get_click_value_review_trainer_" + id).val('1');
            $(".reviewclassfromUser").hide();
            $(".errorMessage").text('');
            $('.showClassuserBtn').show();
            $('#review_cancel_btn_' + id).show();
            $("#rate_class_btn_" + id).hide();
            $("#review_class_btn_" + id).hide();
            $("#rate_trainer_btn_" + id).hide();
            $("#trainer_review_class_box_" + id).show("slow", function() {
                // Animation complete.
            });
        }
        else {
            var reviewText = $("#reviews_text_trainer_" + id).val();
            if (reviewText == '') {
                $("#errorMessage_msg_trainer_review_" + id).text('Message  can not blank.')
                return false;
            }

            jQuery.ajax({
                'type': 'POST',
                'url': "<?php echo Yii::app()->createUrl("TrainerProfileReview/create"); ?>",
                'data': "text=" + reviewText + "&userId=" + userId + "&userType=" + userType,
                'beforeSend': function(jqXHR, settings) {
                    $("#AjaxLoader_" + id).show();
                },
                'success': function(data) {
                    $("#AjaxLoader_" + id).hide();
                    if (data != "redirect" && data != 'fail') {
                        $("#get_click_value_review_trainer_" + id).val('');                        
                        $('.showClassuserBtn').show();
                        $('#review_cancel_btn_' + id).hide();
                        $('#trainer_review_class_box_' + id).hide();
                        $("#reviews_text_trainer_" + id).val('');
                        $("#formResult_" + id).html(data);
                    }
                },
                'cache': false
            });
        }



    }
    function cancelQuery(id) {
        $("#get_click_value_review_class_" + id).val('');
        $("#get_click_value_review_trainer_" + id).val('');
        $(".reviewclassfromUser").hide();
        $(".reviewtrainerfromUser").hide();
        $('.showClassuserBtn').show();
        $('#review_cancel_btn_' + id).hide();
    }

    function rateTotarinner(id, userId, userType, status) {
        jQuery.ajax({
            'type': 'POST',
            'url': "<?php echo Yii::app()->createUrl("ClassCourseTrainnerRate/trainerRate"); ?>",
            'data': "userId=" + userId + "&userType=" + userType + "&status=" + status,
            'beforeSend': function(jqXHR, settings) {
                $("#AjaxLoader_" + id).show();
            },
            'success': function(data) {
                $("#AjaxLoader_" + id).hide();              
                if (data ==1) {
                    var className = $("#rate_trainer_up_btn_"+id).attr('class');
                    array=className.split("  ");
                    if(className=='sprite addmarginR10 thumb-up') {
                        $("#rate_trainer_up_btn_"+id).addClass("thumb-up-rated");
                        $("#rate_trainer_dwn_btn_"+id).removeClass("thumb-down-rated");
                        $("#rate_trainer_dwn_btn_"+id).addClass("thumb-down"); 
                    }
            
                }else{
                    var className = $("#rate_trainer_dwn_btn_"+id).attr('class');
                    array=className.split("  ");
                    if(className=='sprite thumb-down') {
                        $("#rate_trainer_dwn_btn_"+id).addClass("thumb-down-rated");
                        $("#rate_trainer_up_btn_"+id).removeClass("thumb-up-rated");
                        $("#rate_trainer_up_btn_"+id).addClass("thumb-up"); 
                    }
                    
                }
            },
            'cache': false
        });

    }


    function rateToClassCourse(id, classCourseId, status) {    
        var classCourseval = $("#review_class_course_id_" + id).val();       
        jQuery.ajax({
            'type': 'POST',
            'url': "<?php echo Yii::app()->createUrl("ClassCourseTrainnerRate/classCourseRate"); ?>",
            'data': "status=" + status + "&" + classCourseval + "=" + classCourseId,
            'beforeSend': function(jqXHR, settings) {
                $("#AjaxLoader_" + id).show();
            },
            'success': function(data) {
                $("#AjaxLoader_" + id).hide();
                if (data ==1) {
                    var className = $("#rate_class_up_btn_"+id).attr('class');
                    array=className.split("  ");
                    if(className=='sprite addmarginR10 thumb-up') {
                        $("#rate_class_up_btn_"+id).addClass("thumb-up-rated");
                        $("#rate_class_dwn_btn_"+id).removeClass("thumb-down-rated");
                        $("#rate_class_dwn_btn_"+id).addClass("thumb-down"); 
                    }
            
                }else{
                    var className = $("#rate_class_dwn_btn_"+id).attr('class');
                    array=className.split("  ");                  
                    if(className=='sprite thumb-down') {                      
                        $("#rate_class_dwn_btn_"+id).addClass("thumb-down-rated");
                        $("#rate_class_up_btn_"+id).removeClass("thumb-up-rated");
                        $("#rate_class_up_btn_"+id).addClass("thumb-up"); 
                    }
                    
                }
            },
            'cache': false
        });

    }

</script>